<link rel="stylesheet" href="__CDN__/assets/css/quality-standard-form.css">
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}" placeholder="请输入质检标准名称">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">工序:</label>
        <div class="col-xs-12 col-sm-8">
            <select id="c-process_id" class="form-control selectpicker" name="row[process_id]">
                <option value="">请选择工序（可选）</option>
                {foreach name="processList" item="vo" key="key"}
                <option value="{$key}" {if $row.process_id == $key}selected{/if}>{$vo}</option>
                {/foreach}
            </select>
            <span class="help-block">通用标准可以不选择工序，特定工序标准请选择对应工序</span>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">产品:</label>
        <div class="col-xs-12 col-sm-8">
            <select id="c-product_id" class="form-control selectpicker" name="row[product_id]">
                <option value="">请选择产品（可选）</option>
                {foreach name="productList" item="vo" key="key"}
                <option value="{$key}" {if $row.product_id == $key}selected{/if}>{$vo}</option>
                {/foreach}
            </select>
            <span class="help-block">通用标准可以不选择产品，特定产品标准请选择对应产品</span>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">检查项目:</label>
        <div class="col-xs-12 col-sm-8">
            <!-- 动态表单容器 -->
            <div id="check-items-container" class="check-items-container">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <span>检查项目管理</span>
                            <button type="button" class="btn btn-primary btn-sm pull-right" id="add-category-btn">
                                <i class="fa fa-plus"></i> 添加检查类别
                            </button>
                        </h4>
                    </div>
                    <div class="panel-body" id="categories-container">
                        <!-- 动态生成的检查类别将在这里显示 -->
                    </div>
                </div>
            </div>
            <!-- 隐藏的JSON数据字段 -->
            <textarea id="c-check_items" class="form-control hidden" name="row[check_items]" style="display: none;">{$row.check_items|htmlentities}</textarea>
            <span class="help-block">点击"添加检查类别"来创建检查项目，每个类别下可以添加多个检查项</span>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">公差要求:</label>
        <div class="col-xs-12 col-sm-8">
            <!-- 动态公差要求容器 -->
            <div id="tolerance-container" class="tolerance-container">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <span>公差要求管理</span>
                            <button type="button" class="btn btn-primary btn-sm pull-right" id="add-tolerance-btn">
                                <i class="fa fa-plus"></i> 添加公差要求
                            </button>
                        </h4>
                    </div>
                    <div class="panel-body" id="tolerance-items-container">
                        <!-- 动态生成的公差要求将在这里显示 -->
                    </div>
                </div>
            </div>
            <!-- 隐藏的JSON数据字段 -->
            <textarea id="c-tolerance_requirements" class="form-control hidden" name="row[tolerance_requirements]" style="display: none;">{$row.tolerance_requirements|htmlentities}</textarea>
            <span class="help-block">点击"添加公差要求"来设置各项公差标准</span>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">
            <select id="c-status" class="form-control selectpicker" name="row[status]">
                <option value="1" {if $row.status == 1}selected{/if}>启用</option>
                <option value="0" {if $row.status == 0}selected{/if}>禁用</option>
            </select>
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
